package com.wlyuan.index.domain.source.valueobj;

import com.wlyuan.core.domain.valueobj.QuotationId;
import com.wlyuan.core.domain.valueobj.TenantId;
import com.wlyuan.tools.utils.CallUtils;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.ToString;

@AllArgsConstructor
@Getter
@Builder
@ToString
public final class Quotation {
    private QuotationId quotationId;
    private QuotationNo quotationNo;
    private QuotationStatus status;
    private Integer source;
    private TenantId tenantId;

    public int getPriority() {
        return CallUtils.call(QuotationStatus::getPriority, status);
    }

    public boolean isCanQuote() {
        return null == status || status.isCanQuote();
    }
}